<extend name="./public/frame.html"/>
<block name="content">
    <div class="layer_content">
        <div class="layer_form">
            <div class="down_icon"></div>
            <div class="layer_div">
                <div class="layer_tit">
                    用户号码：
                </div>
                <div class="layer_control">
                    <input type="text" class="w180" id="user_phone" placeholder="用户手机号搜索">
                </div>
            </div>
            <div class="layer_div">
                <div class="layer_tit">
                    退款类型：
                </div>
                <div class="layer_control">
                    <select id="money_statement" class="w180">
                        <option value="">状态</option>
                        <?php foreach($typeList as $key=>$value):?>
                        <option value="<?php echo $key;?>"><?php echo $value;?></option>
                        <?php endforeach;?>
                    </select>
                </div>
            </div>
            <div class="layer_div">
                <div class="layer_tit">
                    退款时间：
                </div>
                <div class="layer_control">
                    <input type="text" class="w180 date" id="start" placeholder="退款时间（起止）">
                </div>
            </div>
            <div class="layer_div">
                <div class="layer_tit">
                    退款时间：
                </div>
                <div class="layer_control">
                    <input type="text" class="w180 date" id="end" placeholder="退款时间（结束）">
                </div>
            </div>
            <div class="layer_div">
                <div class="layer_tit">
                    退款去向：
                </div>
                <div class="layer_control">
                    <select id="pay_type" class="w180">
                        <option value="">退款去向</option>
                        <?php foreach($pay_type as $key=>$value):?>
                        <option value="<?php echo $key;?>"><?php echo $value;?></option>
                        <?php endforeach;?>
                    </select>
                </div>
            </div>
            <div class="button_search">
                <button class="layui-btn" data-type="search">搜索</button>
            </div>
        </div>
    </div>
    <table class="layui-table" lay-data="{width:'auto', height:'auto', url:'{:url('UserRechargeLog/table')}',page: true, limit: 10,where:{statement:'refund'},id:'refund'}" lay-filter="refund">
        <thead>
            <tr>
                <th lay-data="{field:'money_id', width:80, fixed: true, align:'center'}">ID</th>
                <th lay-data="{field:'uid', width:80, fixed: true, align:'center'}">UID</th>
                <th lay-data="{field:'user_phone', width:120, align:'center'}">手机号</th>
                <th lay-data="{field:'out_trade_no', width:220, align:'center'}">退款流水号</th>
                <th lay-data="{field:'statement_type', width:150, align:'center'}">退款类型</th>
                <th lay-data="{field:'money', width:150, align:'center'}">退款金额</th>
                <th lay-data="{field:'time', width:180, align:'center'}">退款时间</th>
                <th lay-data="{field:'type', width:150, align:'center'}">退款去向</th>
            </tr>
        </thead>
    </table>
    <script>
        layui.use(['table','element','layer','laydate'], function () {
            var element = layui.element,layer=layui.layer,table = layui.table,laydate = layui.laydate;
            var $ = layui.jquery;
            lay('.date').each(function(){
                laydate.render({
                    elem: this
                    ,theme: '#393D49'
                    ,type: 'datetime'
                    ,trigger: 'click'
                });
            });

            //充值记录
            table.on('tool(refund)', function (obj) {

            });
            //搜索
            var $ = layui.jquery, active = {
                search: function () {                                               //推广记录搜索
                    var user_phone  = $.trim($('#user_phone').val()),				//省份
                        money_statement      = $.trim($('#money_statement').val()),
                        start       = $.trim($("#start").val()),
                        end         = $("#end").val(),
                        pay_type    = $("#pay_type").val();
                    table.reload('refund', {
                        url: '/admin/UserRechargeLog/table', where: {
                            "user_phone": user_phone,
                            "money_statement": money_statement,
                            "start":start,
                            "end":end,
                            "pay_type":pay_type,
                            "statement":'refund'
                        }
                    });
                }
            };
            $('.layui-btn').on('click', function () {
                var type = $(this).data('type');
                active[type] ? active[type].call(this) : '';
            });
        });
    </script>
</block>
